package game;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

import org.xml.sax.InputSource;

public class Inputs {
	public float gravidade = 0;
	public float impulso0 = 0;
	public float impulso1 = 0;
	
	public Inputs(){
		
	}
	
	public void Carrega(String path){
		
		FileInputStream stream = null;
		try {
			stream = new FileInputStream(path);
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		InputStreamReader reader = new InputStreamReader(stream);
		BufferedReader bfr = new BufferedReader(reader);
		
		
		String line = "";
		
		try{
			while((line = bfr.readLine())!=null){
				if(line.charAt(0)!= '#'){
					String strs[] = line.split(";");
					
					String tipo = strs[0].toString();
					System.out.println(strs[0] + ": ");
					
					switch (tipo){
					
					case "Gravidade":
						
						gravidade = Float.parseFloat(strs[1]);
						System.out.println(gravidade);
						break;
					
					case "Impulso0":
						impulso0 = Float.parseFloat(strs[1]);
						System.out.println(impulso0);
						break;
						
					case "Impulso1":
						impulso1 = Float.parseFloat(strs[1]);
						System.out.println(impulso1);
						break;
						
					default:
						break;
					
					}
					
				}
				
			}
		}catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
